<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="https://www.texmacs.org/2002/extensions" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <head>
    <title>TeXmacs notes</title>
    <meta content="TeXmacs 1.99.19" name="generator"></meta>
    <link href="../resources/notes-base.css" type="text/css" rel="stylesheet"></link>
    <link href="../resources/blog-icon.png" rel="icon"></link>
    <script src="../resources/highlight.pack.js" language="javascript" defer></script>
    <script src="../resources/notes-base.js" language="javascript" defer></script>
  </head>
  <body>
    <div class="notes-header">
      <p>
        <img class="image" src="../resources/texmacs-blog-transparent.png" width="28.116784"></img><span style="margin-left: 2pt"></span><a href="./main.html">[main]</a><em
        class="notes-header-name">Notes on TeXmacs</em>
      </p>
    </div>
    <h1 id="auto-1">TeXmacs and the art of mathematical writing<span style="margin-left: 1em"></span></h1>
    <div class="notes-abstract">
      <p>
        A blog post which presents the motivations behind the design of
        TeXmacs from a personal perspective.<br />[by <a href="https://twitter.com/maxgubi">@maxgubi</a>]
      </p>
    </div>
    <p>
      
    </p>
    <div style="margin-top: 0.5em; margin-left: 42.175176192px; margin-right: 42.175176192px">
      <p>
        I can't go to a restaurant and order food because I keep looking at
        the fonts on the menu.
      </p>
    </div>
    <div style="margin-bottom: 0.5em; margin-left: 42.175176192px; margin-right: 42.175176192px">
      <p>
        D. Knuth [<a href="#bib-MR1879858">6</a>]
      </p>
    </div>
    <p>
      
    </p>
    <p>
      As a researcher, teacher, and simply enthusiast, I spend a lot of time
      creating electronic documents that talk about math, physics, or other
      various technical topics, such as programming. Using a computer, instead
      of paper and pen, has the advantage that documents can be easily copied,
      shared, replicated with small or large changes, projected on a screen
      and even printed, if one truly misses paper and the relative sensory
      experience. There are also many disadvantages, though: the loss of
      immediacy associated with using a tool that we have practiced for most
      of our life; the freedom from a precise scheme, or the flexibility to
      make a drawing quickly and organize the text in non-coded ways, without
      a predetermined format, without the tool requiring excessive attention,
      or ancillary concerns. The most important thing in using pen and paper,
      which is difficult to obtain otherwise, is the possibility of
      concentrating on the essential, that is, on communicating (or simply
      recording) an idea, a concept, a new result.
    </p>
    <p>
      Is it possible to find a &ldquo;middle ground&rdquo; between these two
      apparently complementary choices? A tool that lets you preserve the
      qualities of both? Those who have used programs like Microsoft Word or
      Knuth's TeX system [<a href="#bib-knuth_computers_1986">5</a>] are well aware that writing formulas
      on the computer is not easy. In Word, immediacy is rewarded with
      sloppiness of the result and with graphical interfaces that tend to
      infantilize the user. In TeX, however, the perfection of the result is
      paid for with a user interface conceived for the computers from the '80s
      and which represents the contents in a form more suited to electronic
      processing than to the expressive needs of the human writer.
    </p>
    <p>
      In College, learning how to use the TeX/LaTeX system [<a href="#bib-knuth_computers_1986">5</a>, <a
      href="#bib-lamport_latex_1994">7</a>, <a href="#bib-gratzer_what_2011">2</a>] is a must for anyone who studies math or
      physics or has to deal with more than a couple of formulas here and
      there. Like many others, I have used it for several years, with a
      mixture of admiration and disgust. On even days, I thought it was a work
      of high craftsmanship (of medieval flavor, full of  self-denial,
      mysticism, all witnessed by the versioning number of the program
      converging inexorably towards <span class="no-breaks"><img src="art-of-math-writing-1.png" style="margin-left: -0.0206868686868687em; margin-bottom: -0.0103838383838384em; margin-right: -0.0206868686868686em; margin-top: -0.0413737373737374em; vertical-align: -0.0103030303030303em; height: 0.693010101010101em"></img>).</span>
      On odd days, I searched around for ways to get out of the constant
      torture (perhaps also a consequence of the very same medieval spirit) of
      composing my works in LaTeX.
    </p>
    <p>
      At some point, however, I stumbled upon TeXmacs. TeXmacs is a project
      born in the '90s with the aim of allowing mathematicians to express
      their ideas in a natural and immediate way and at the same time produce
      documents of the highest quality possible on current computers. In the
      beginning, the mathematician involved was actually only one, Joris van
      der Hoeven, who had started to imagine an alternative to TeX and at the
      same time had also begun to implement it by programming TeXmacs, a
      scientific editing system [<a href="#bib-vdH:gut">8</a>]. The name comes from TeX
      (obvious) and <class style="font-variant: small-caps">Emacs</class> (another well known system, a
      programmable text editor), but in the end it turns out that TeXmacs no
      longer has much to do with either, other than having inherited two
      ambitions: that to typographic excellence and that to complete
      extensibility. Van der Hoeven wanted to put his ideas on the computer in
      the most pleasant form possible: pleasant to type and pleasant to look
      at. He wanted to be able to concentrate on the content most of the time,
      on theorems, proofs, footnotes, explanatory schemes, reference tables.
      And concurrently, but only at the right time, he wanted to be able to
      concentrate on the small technical details, and that changing the
      program interface to suit various types of use and user would be easy.
    </p>
    <div style="margin-top: 1em; margin-bottom: 1em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em"><img class="image" src="art-of-math-writing-2.recursive-1.png" width="100%"></img></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; height: 0.5em"></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; padding-left: 0.5em; padding-right: 0.5em"><div class="caption">
            <font style="font-size: 90.0%"><p>
              <b>Figure 1. </b><a id="auto-2"></a><a id="fig:self"></a>This article has been
              written in TeXmacs. The image shows the article being drafted
              and the management of the figures within the program.
            </p></font>
          </div></td>
        </tr></tbody>
      </table>
    </div>
    <p>
      In short, the TeXmacs system was born from the idea of making
      mathematical writing on the computer as immediate and rewarding as paper
      &amp; pen writing. This was only possible by starting from scratch and
      building a new program: TeXmacs is not derived from TeX and does not try
      to be 100% compatible with it.
    </p>
    <p>
      TeXmacs is a &ldquo;free software&rdquo;: not only it is free, but
      anyone can use it, copy it and modify it as they wish. In practice,
      however, there is a small community of developers and users who take
      care of keeping it in good shape and making it grow. Shortly after I
      discovered it by accident in my research for an alternative to LaTeX, I
      started using it and now, like many other users, I use it every day to
      write my lectures, student worksheets, scientific articles. And I also
      use it to &ldquo;think&rdquo;, to do calculations and to take notes for
      new research. For example, I am writing this article in TeXmacs, and
      later maybe I can export it to PDF or HTML/MathJax [<a href="#bib-cervone_math_2012">1</a>] or
      even LaTeX as needed, but for now I can concentrate on the text without
      &ldquo;visual noise&rdquo; on my computer screen (Figure <a href="#fig:self">1</a>).
    </p>
    <p>
      But I have to be honest. The first time I tried using TeXmacs I didn't
      quite like it: what I was trying to do didn't work and I quickly decreed
      that it was an amateur product, like many open source projects which
      started on good ground and enthusiasm without this being enough to
      achieve a serious result. In short, LaTeX was much better. Later on, by
      chance, I stumbled on it again, and with a little patience and an open
      mind I took a proper look at the manual to better understand the logic
      of the program and its use. And I realized that TeXmacs is instead a
      mature system, based on a series of concepts that deeply affect all
      aspects of the program: the hierarchical nature of the documents and the
      related structured edition, the visual navigation, the use of
      combinations of intuitive keys, the deduplication of the ways to invoke
      the various commands.
    </p>
    <p>
      The ideas are simple but are not frequently found together in other more
      commonly used programs. For this reason, a little humility and
      intellectual curiosity are required to the novice user. If nothing else,
      one needs to take a look at the manual before deciding that the program
      is not working properly. TeXmacs requires an understanding of basic
      principles that cannot be traced back to the intuitive experience of the
      user familiar with Word or LaTeX.
    </p>
    <p>
      In exchange for this little initial effort, you can start writing
      formulas or equations more smoothly, seeing them appear on the screen as
      they are written (Figure <a href="#fig:ui">2</a>). It is truly within everyone's
      reach. During the last spring's lockdown, one of my children (attending
      middle school) had to send solutions to math homework to his teacher. A
      quick demonstration was enough to allow him to use TeXmacs: start a
      formula, write fractions and so on. Nothing complicated in itself, but
      difficult to obtain satisfactorily in Word and impossible to achieve
      quickly and easily in LaTeX. In a short time my son was able to send his
      results to his teacher in an aesthetically pleasing PDF document.
    </p>
    <div style="margin-top: 1em; margin-bottom: 1em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em"><table style="display: inline-table; vertical-align: middle">
            <tbody><tr>
              <td style="text-align: center"><img class="image" src="art-of-math-writing-3.png" width="100%"></img></td>
            </tr></tbody>
          </table></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; height: 0.5em"></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; padding-left: 0.5em; padding-right: 0.5em"><div class="caption">
            <font style="font-size: 90.0%"><p>
              <b>Figure 2. </b><a id="auto-3"></a><a id="fig:ui"></a>TeXmacs user interface.
              Here the editing of an article on the computational complexity
              of multiplication. The light blue and gray rectangles are
              annotations that allow you to visually identify the hierarchical
              structure of the document (which is basically represented via a
              tree graph). The toolbars at the top can be hidden without
              losing essential functionality, accessible via keyboard or menu.
            </p></font>
          </div></td>
        </tr></tbody>
      </table>
    </div>
    <p>
      I find it a valid alternative to LaTeX, both  in academia and in high
      school: for researchers to write papers or even books, for teachers to
      write worksheets or handouts and for students to write their theses or
      research reports. TeXmacs allows you to easily create presentations
      (&ldquo;beamer&rdquo; style) or posters and it is also suitable as an
      &ldquo;electronic blackboard&rdquo;, especially useful in this period of
      forced distance learning. For example, I teach by sharing a TeXmacs
      window via Zoom with my students, and I write what I would have written
      on the blackboard in other times. Finally I can produce a PDF which I
      can send to them as course notes (Figure <a href="#fig:corso">3</a>). TeXmacs has
      also other features bridging towards a complete scientific office suite
      [<a href="#bib-gubinelli_gnu_2014">3</a>]: it is fully extensible via an embedded scripting
      language (Figure <a href="#fig:corso-2">4</a>), it features spreadsheet-like
      functionalities and a tool to compare different versions of a document.
      Moreover it supports the integrated interactive execution of external
      programs, of computer algebra systems like Maxima, Axiom, Mathematica,
      Sage, of graphical programs like Asymptote, GNU plot, Python's
      Mathplotlib, Graphviz, Geogebra, Eukleides and even of LaTeX packages
      like TikZ or FeynMF. Finally, an integrated Jupyter client is under
      development.
    </p>
    <p>
      For those who are passionate about programming, TeXmacs also presents
      the opportunity to contribute to, to extend, or simply to contemplate, a
      computer system that has to perform a series of complex tasks: one part
      of the program takes care of typographical composition (with algorithms
      similar to those used in TeX, see Figure <a href="#fig:corso-2">4</a>), another deals
      with the user interaction (graphical interface, mouse and screen
      management), with the conversion from and to other formats (HTML, PDF,
      LaTeX), with the bibliographic references, yet another takes care of the
      edition of simple vector graphic contents. The user interface is written
      in Scheme (a dialect of Lisp, itself inspired by Church's lambda
      calculus). This allows one to program complex behaviors relatively
      easily and also to increase the program's capabilities without having to
      recompile it. The most critical parts are instead written in C ++ to
      ensure responsiveness in the interaction with the user.
    </p>
    <p>
      To summarize: for twenty years TeXmacs has been a resource available to
      professional mathematicians and a wider audience, including university
      students and high school teachers and students. More information can be
      found on the program's website <a href="www.texmacs.org"><tt>www.texmacs.org</tt></a>,
      including documentation and some introductory videos. Various tutorials
      and demonstrations are also hosted on YouTube. TeXmacs is also a
      community project that gathers mathematicians (and non-mathematicians)
      who are passionate about programming and sharing. New versions are
      regularly released both to eliminate the inevitable bugs and to
      introduce new features. Over the years the program has evolved, improved
      and adapted to the technological landscape, but the basic idea remains
      the same: that of aspiring to be a tool that allows the writer a great
      &ldquo;quality&rdquo; of experience: like a fountain pen, a musical
      instrument or programming languages such as Lisp or Haskell. Trying to
      explain TeXmacs' <i>raison d'&ecirc;tre</i>, van der Hoeven says:
    </p>
    <div style="margin-top: 0.5em; margin-left: 42.175176192px; margin-right: 42.175176192px">
      <p>
        The ideal writing tool must behave like your first art pen: release
        your desire to write, make you feel one with the tool, and
        occasionally surprise you with the beauty of your own words.
      </p>
    </div>
    <div style="margin-bottom: 0.5em; margin-left: 42.175176192px; margin-right: 42.175176192px">
      <p>
        J. van der Hoeven [<a href="#bib-vdH:tm">4</a>].
      </p>
    </div>
    <div style="margin-top: 1em; margin-bottom: 1em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em"><table style="display: inline-table; vertical-align: middle">
            <tbody><tr>
              <td style="text-align: center; vertical-align: middle; text-align: center"><img class="image" src="art-of-math-writing-4.png" width="100%"></img></td>
            </tr><tr>
              <td style="text-align: center"><img class="image" src="art-of-math-writing-5.png" width="100%"></img></td>
            </tr></tbody>
          </table></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; height: 0.5em"></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; padding-left: 0.5em; padding-right: 0.5em"><div class="caption">
            <font style="font-size: 90.0%"><p>
              <b>Figure 3. </b><a id="auto-4"></a><a id="fig:corso"></a>Above, lecture notes for
              a probability course at the University of Bonn. Below, an
              example of a presentation that collects both structural elements
              such as the title and the statement of a theorem, and elements
              without a particular format, such as a drawing. In both cases
              the graphical elements were created through the built-in figure
              editor.
            </p></font>
          </div></td>
        </tr></tbody>
      </table>
    </div>
    <div style="margin-top: 1em; margin-bottom: 1em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em"><table style="display: inline-table; vertical-align: middle">
            <tbody><tr>
              <td style="text-align: center; vertical-align: middle"><img class="image" src="art-of-math-writing-6.Screenshot 2019-05-11 at 13.20.30.png" width="100%"></img></td>
            </tr><tr>
              <td style="text-align: center"></td>
            </tr><tr>
              <td style="text-align: center"><img class="image" src="art-of-math-writing-7.texmacs-micro-typography.png" width="100%"></img></td>
            </tr></tbody>
          </table></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; height: 0.5em"></td>
        </tr><tr>
          <td style="text-align: center; padding-left: 0em; padding-right: 0em; padding-left: 0.5em; padding-right: 0.5em"><div class="caption">
            <font style="font-size: 90.0%"><p>
              <b>Figure 4. </b><a id="auto-5"></a><a id="fig:corso-2"></a>Above, documents can be
              scripted via Scheme to provide complex automatic transformations
              of the contents. Below, mathematical typography does not let
              itself be captured by simple formulas: all the multiple
              parameters that describe the relative position of the various
              elements of a formula must be carefully calibrated by hand by
              the digital typographer for an optimal result. The image shows
              the various documents that are used in development to carry out
              this fine-tuning.
            </p></font>
          </div></td>
        </tr></tbody>
      </table>
    </div>
    <h1 id="auto-6">Bibliography<span style="margin-left: 1em"></span></h1>
    <div class="compact-block" style="text-indent: 0em">
      <font style="font-size: 84.0%"><dl>
        <p>
          <dt>
            <strong>[1]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-cervone_math_2012"></a>D. Cervone. Math Jax: A Platform for Mathematics on
              the Web. <i>Notices of the American Mathematical Society</i>,
              59(2):312&ndash;315, 2012.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[2]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-gratzer_what_2011"></a>G. Gr&auml;tzer. What is new in LaTeX? IV. WYSIWYG
              LaTeX. <i>Notices of the American Mathematical Society</i>,
              58(6):828&ndash;830, 2011.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[3]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-gubinelli_gnu_2014"></a>M. Gubinelli, J. v. d. Hoeven, F. Poulain, and D.
              Raux. GNU TeXmacs: Towards a Scientific Office Suite. In
              <i>Mathematical Software - ICMS 2014 - 4th International
              Congress, Seoul, South Korea, August 5-9, 2014. Proceedings</i>,
              pages 562&ndash;569. 2014.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[4]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-vdH:tm"></a>J. v. d. Hoeven. <i>The Jolly Writer. Your Guide to
              GNU TeXmacs</i>. Scypress, 2020.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[5]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-knuth_computers_1986"></a>D. Knuth. <i>Computers &amp; Typesetting, Volume A:
              The TeXbook</i>. Addison-Wesley Professional, Reading, Mass, 1st
              edition edition, jan 1986.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[6]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-MR1879858"></a>D. Knuth. All questions answered. <i>Notices of the
              American Mathematical Society</i>, 49(3):318&ndash;324, 2002.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[7]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-lamport_latex_1994"></a>L. Lamport. <i>LaTeX: A Document Preparation
              System</i>. Addison-Wesley Professional, Reading, Mass, 2nd
              edition edition, jun 1994.
            </p>
          </dd>
        </p>
        <p>
          <dt>
            <strong>[8]  </strong>
          </dt>
          <dd>
            <p>
              <a id="bib-vdH:gut"></a>J. van der Hoeven. GNU TeXmacs: a free, structured,
              WYSIWYG and technical text editor. In D. Flipo, editor, <i>Le
              document au XXI-i&egrave;me si&egrave;cle</i>, volume
              39&ndash;40, pages 39&ndash;50. Metz, 14&ndash;17 mai 2001.
              Actes du congr&egrave;s GUTenberg.
            </p>
          </dd>
        </p>
      </dl></font>
    </div>
    <p>
      
    </p>
  </body>
</html>